import yaml
import InfoTracer
import ReInfo
from selenium import webdriver

# 读取配置文件
with open("config.yaml", "r", encoding="utf-8") as file:
    config = yaml.safe_load(file)

# 使用配置
weapon_dict = config["weapon_dict"]
coordinates = config["coordinates"]
preferences = config["account_preferences"]


driver = InfoTracer.init_driver()
InfoTracer.input_default_info(
    driver=driver,
    preferences=preferences,
    weapon_dict=weapon_dict,
    coordinates=coordinates,
)  # 按需筛选账号

# 抓取并解析账号信息
details_list = InfoTracer.extract_account_info(driver)
price_list = InfoTracer.extract_account_price(driver)

# 调用函数
formatted_info = ReInfo.extract_account_info(details_list, price_list)

# 输出结果
for item in formatted_info:
    print(item)

driver.quit()